<!DOCTYPE html>
<html lang="zh-cn">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<meta name="renderer" content="webkit">
<title>商品列表</title>
<link rel="stylesheet" href="{{ asset('admin_style/css/pintuer.css') }}">
   <link rel="stylesheet" href="{{ asset('admin_style/css/admin.css') }}">
    <script src="{{asset('admin_style/js/jquery.js')}}"></script>
    <script src="{{asset('admin_style/js/pintuer.js')}}"></script>
<link rel="stylesheet" href="{{asset('admin_style/css/style.css')}}">
<!--<link rel="stylesheet" href="css/ace.min.css">-->
<script src="{{asset('admin_style/js/layer/layer.js')}}"></script>
</head>
<body>
<div id="box">
<form method="post" action="" id="listform">
  <div class="panel admin-panel">
    <div class="panel-head"><strong class="icon-reorder"> 商品回收站</strong> <a href="" style="float:right; display:none;">添加字段</a></div>
    <table class="table table-hover text-center">
      <tr>
        <th width="100" style="text-align:left; padding-left:20px;">编号</th>
        <th>产品名称</th>
        <th>单价</th>
        <th>分类</th>
        <th>库存</th>
        <th>上架</th>
        <th>精品</th>
        <th>新品</th>
        <th>热销</th>
        <th width="310">操作</th>
      </tr>
       @foreach($data as $v)
        <tr>
          <td style="text-align:left; padding-left:20px;"><input type="checkbox" name="check" value="{{$v->g_id}}" />{{$v->g_id}}</td>
          <td>{{$v->g_name}}</td>
          <td>{{$v->g_original_price}}</td>
          <td>{{$v->cate_name}}</td>
          <td>{{$v->g_reper}}</td>
          <td>{{$v->g_putaway}}</td>
          <td>{{$v->g_boutique}}</td>
          <td>{{$v->g_special}}</td>
          <td>{{$v->g_hot}}</td>
          <td><div class="button-group"> <a class="button border-red" href="{{ url('admin/one_del/'.$v->g_id)}}" onclick="return del(1,1,1)"><span class="icon-trash-o"></span> 删除</a><a class="button border-main icon-check" href="{{ url('admin/one_huan/'.$v->g_id)}}" ><span class="icon-trash-o"></span> 还原</a></div></td>
        </tr>
      @endforeach
      <tr>
        <td style="text-align:left; padding:19px 0;padding-left:20px;"><input type="checkbox" id="checkall" onclick="checkAll()"/>
          全选 </td>
        <td colspan="10" style="text-align:left;padding-left:20px;"><a href="javascript:void(0)" class="button border-red icon-trash-o" style="padding:5px 15px;" onclick="dels()"> 批量删除</a> 
      			<a href="javascript:void(0)" class="button border-main icon-check" style="padding:5px 15px;" onclick="huan()"> 还原</a> 
        </td>
      </tr>
    </table>
    <center><div class="fenye">{{$data->links()}}</div></center>
  </div>
</form>
</div>
<script type="text/javascript">

//搜索
function changesearch(){	
		
}

//单个删除
function del(id,mid,iscid){
	if(confirm("您确定要删除吗?")){
		
	}
}

//全选
function checkAll(){
  var str = document.getElementsByName('check');
  var mo = document.getElementById('checkall');
  var status = mo.checked;
  if(status){
    for(var i=0;i<str.length;i++){
      str[i].checked=true;
    }
  }else{
    for(var i=0;i<str.length;i++){
      str[i].checked=false;
    }
  }
}

//批量删除
function dels(){
  var check = document.getElementsByName('check');
  var ids=[];
  for(var i=0;i<check.length;i++){
    if(check[i].checked){
      ids.push(check[i].value);
    }
  }
  var str = ids.join(',');
    var xh      = new XMLHttpRequest();
    xh.open('get',"{{ url('admin/goods_del/')}}/"+str,true);
    xh.send();
    xh.onreadystatechange = function(){
        if(xh.readyState == 4 && xh.status==200){
            document.getElementById('box').innerHTML=xh.responseText;
        }
    }
}
//还原
function huan(){
  var check = document.getElementsByName('check');
  var ids=[];
  for(var i=0;i<check.length;i++){
    if(check[i].checked){
      ids.push(check[i].value);
    }
  }
  var str = ids.join(',');
    var xh      = new XMLHttpRequest();
    xh.open('get',"{{ url('admin/goods_huan/')}}/"+str,true);
    xh.send();
    xh.onreadystatechange = function(){
        if(xh.readyState == 4 && xh.status==200){
            document.getElementById('box').innerHTML=xh.responseText;
        }
    }
}

</script>
</body>
</html>
